Due to the widespread use of data networks to communicate a variety of information, data security has become a concern. Confidential information on a private network may be accessed and/or intercepted by unauthorized parties when connected to an untrusted network, e.g., the Internet. A suite of Internet Protocol Security (IPSec) protocols defined by the Internet Engineering Task Force (IETF) is designed to provide secure communications over the Internet via data encryption. In the IPSec protocols, such as Authentication Headers (AH) and Encapsulating Security Payload (ESP), a sequence number is communicated and used to protect against a replay attack. In a replay attack, an attacker or adversary copies an intercepted packet and replays the information or packet to one or both parties to obtain confidential information from a party. Anti-replay algorithms are designed to effectively distinguish between actual replay attacks and out-of-order packets caused by various network conditions. For example, packets may arrive out of order due to parallel processing inside routers, splitting traffic among multiple links with different delays, and/or route change with different end-to-end delay. ESP/AH implements an anti-replay sliding window protocol to secure against an adversary inserting messages or replayed packets into a secure communication channel.